@extends('layouts.admin')
@section('title','文章列表')


@section('content')

    <!-- Main content -->
    <section class="content">
      <div class="row">
        <div class="col-xs-12">
          <div class="box">
            <div class="box-header">
             <a href="{{route('admin.article.create')}}"><button type="button" class="btn bg-maroon btn-flat margin">新增</button></a>
             <button type="button" class="btn bg-olive btn-flat margin">删除</button>
             <div class="box-tools">
                <div class="input-group input-group-sm" style="width: 150px;">
                  <input type="text" name="table_search" class="form-control pull-right" placeholder="Search">

                  <div class="input-group-btn">
                    <button type="submit" class="btn btn-default"><i class="fa fa-search"></i></button>
                  </div>
                </div>
              </div>
            </div>
            <!-- /.box-header -->
            <div class="box-body">
              <table id="example2" class="table table-bordered table-hover">
                <thead>
                <tr>
                	<th></th>
                	<th>id</th>
                  	<th>标题</th>
                  	<th>状态</th>
                  	<th>是否可评论</th>
                  	<th>浏览数</th>
                  	<th>创建时间</th>
                    <th>首页图片</th>
                  	<th>操作</th>
                </tr>
                </thead>
                <tbody>
                @foreach($list as $v)
                <tr>
                	<td><input type="checkbox"></td>
                  	<td>{{$v->id}}</td>
                    <td>{{$v->title}}</td>
                  	<td>@if($v->status==0)
                        <span class="label label-danger">审核中</span>
                        @else
                        <span class="label label-info">正常</span>
                        @endif</td>
                  	<td>
                        @if($v->post_lock==0)
                        <span class="label label-danger">可评论</span>
                        @else
                        <span class="label label-info">不可评论</span>
                        @endif
                    </td>
                  	<td>{{$v->visit_cnt}}</td>
                  	<td>{{$v->created_at}}</td>
                  	<td><img src="{{asset($v->firstPic['path'])}}" style="width: 100px; height: 50px;"></td>
                  	<td>
	                  	<a href="{{route('admin.article.edit',['id'=>$v->id])}}" type="button" class="btn btn-info">编辑</a>
	                  	<a href="{{route('admin.article.destroy',['id'=>$v->id])}}" type="button" class="btn btn-danger ajax-get" data-confirm="确定要删除吗？" data-success="removeTr">删除</a>
                        @if($v->status==0)
                        <a href="{{route('admin.article.publish',['id'=>$v->id])}}" type="button" class="btn btn-info ajax-get" data-success="reload">发布</a>
                        @else
                        <a href="{{route('admin.article.unpublish',['id'=>$v->id])}}" type="button" class="btn btn-info ajax-get" data-success="reload">取消发布</a>
                        @endif

              		</td>
                
                </tr>
                @endforeach
              
                </tbody>
              </table>
            </div>
            <!-- /.box-body -->
            
          </div>
          

          
     
          <!-- /.box -->
        </div>
        <!-- /.col -->
      </div>
      <!-- /.row -->
    </section>
    <!-- /.content -->
 


@endsection